| Conditions | 2 |
| Total Lines | 21 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { HttpService } from '@nestjs/axios'; |
||
| 12 | |||
| 13 | public async createPost(channelId: string, message: string): Promise<object> { |
||
| 14 | try { |
||
| 15 | const response = await this.httpService.axiosRef.post( |
||
| 16 | `${this.configService.get<string>('MATTERMOST_API_URL')}/posts`, |
||
| 17 | { |
||
| 18 | channel_id: channelId, |
||
| 19 | message |
||
| 20 | }, |
||
| 21 | { |
||
| 22 | headers: { |
||
| 23 | Authorization: `Bearer ${this.configService.get<string>( |
||
| 24 | 'MATTERMOST_ALFRED_TOKEN' |
||
| 25 | )}` |
||
| 26 | } |
||
| 27 | } |
||
| 28 | ); |
||
| 29 | |||
| 30 | return response.data; |
||
| 31 | } catch (e) { |
||
| 32 | console.log('ERROR: ', e); |
||
| 33 | } |
||
| 71 |